package ui.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ui.dao.DemoMapper;
import ui.model.bo.DemoInfoBo;
import ui.model.po.DemoInfoPo;
import ui.model.vo.DemoInfoVo;
import ui.service.DemoInfoService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by qiang.yu on 2017/5/2.
 */
@Service
public class DemoInfoServiceImpl implements DemoInfoService{

    @Autowired
    private DemoMapper demoMapper;


    @Override
    public Map<String, Object> getAllDemoInfo(DemoInfoBo bo) {
        Map<String, Object> map = new HashMap<String, Object>();
        List<DemoInfoVo> list = demoMapper.getAllDemoInfo(bo);
        map.put("rows",list);
        map.put("total",list.size());
        return map;
    }

    @Override
    public Map<String, Object> updateDemoInfoByPkid(DemoInfoPo po) {
        Map<String, Object> map = new HashMap<String, Object>();
        demoMapper.updateDemoInfoByPkid(po);
        map.put("success","10");
        return map;
    }

    @Override
    public Map<String, Object> insertDemoInfo(DemoInfoPo po) {
        Map<String, Object> map = new HashMap<String, Object>();
        demoMapper.insertDemoInfo(po);
        map.put("success","10");
        return map;
    }

    @Override
    public Map<String, Object> deleteDemoInfo(DemoInfoPo po) {
        Map<String, Object> map = new HashMap<String, Object>();
        demoMapper.deleteDemoInfo(po);
        map.put("success","10");
        return map;
    }
}
